package com.shd.controller;

import com.netflix.appinfo.EurekaInstanceConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by shanhaodong on 2018/8/31
 */
@RestController
public class HelloController {
    private final Logger LOG = LoggerFactory.getLogger(HelloController.class);


    @Autowired
    private EurekaInstanceConfig config;

    @GetMapping("/hello")
    public String index() {
        LOG.info("/hello, InstanceId:{},host:{}", config.getInstanceId(), config.getHostName(false));
        return "hello world";
    }
}
